/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package persistence;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * This class is a JPA entity and is used to encapsulate the
 * Assignment composed primary key
 * 
 * @author Amigos do Noddy
 *
 */
@Embeddable
public class AssignmentPK implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Column(name = "REFIDPERSON_ADM", nullable = false)
    private int refidpersonAdm;
    @Column(name = "REFIDPERSON_ASS", nullable = false)
    private int refidpersonAss;
    @Column(name = "REFIDTICKET", nullable = false)
    private int refidticket;

    public AssignmentPK() {
    }

    /**
     * Class constructor
     * 
     * @param refidpersonAdm administrator id
     * @param refidpersonAss assistant id
     * @param refidticket ticket id
     */
    public AssignmentPK(int refidpersonAdm, int refidpersonAss, int refidticket) {
        this.refidpersonAdm = refidpersonAdm;
        this.refidpersonAss = refidpersonAss;
        this.refidticket = refidticket;
    }

    /**
     * 
     * @return administrator id
     */
    public int getRefidpersonAdm() {
        return refidpersonAdm;
    }

    /**
     * Sets the administrator id
     * @param refidpersonAdm administrator id
     */
    public void setRefidpersonAdm(int refidpersonAdm) {
        this.refidpersonAdm = refidpersonAdm;
    }

    /**
     * 
     * @return assistant id
     */
    public int getRefidpersonAss() {
        return refidpersonAss;
    }

    /**
     * Sets the assistant id
     * 
     * @param refidpersonAss assistant id
     */
    public void setRefidpersonAss(int refidpersonAss) {
        this.refidpersonAss = refidpersonAss;
    }

    /**
     * 
     * @return ticket id
     */
    public int getRefidticket() {
        return refidticket;
    }

    /**
     * Sets the ticket id
     * @param refidticket ticket id
     */
    public void setRefidticket(int refidticket) {
        this.refidticket = refidticket;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) refidpersonAdm;
        hash += (int) refidpersonAss;
        hash += (int) refidticket;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AssignmentPK)) {
            return false;
        }
        AssignmentPK other = (AssignmentPK) object;
        if (this.refidpersonAdm != other.refidpersonAdm) {
            return false;
        }
        if (this.refidpersonAss != other.refidpersonAss) {
            return false;
        }
        if (this.refidticket != other.refidticket) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.AssignmentPK[refidpersonAdm=" + refidpersonAdm + ", refidpersonAss=" + refidpersonAss + ", refidticket=" + refidticket + "]";
    }

}
